<%@ page language="java" contentType="text/html; charset=US-ASCII"
	pageEncoding="US-ASCII"%>
<%@ page import="structures.ProductList"%>
<%@ page import="structures.Product"%>
<%
	ProductList list = (ProductList) session.getAttribute("advertisements");
	session.removeAttribute("advertisements");
	String imageSource = "http://localhost:8080/DatabaseRESTWebService/GetADImage?idAdvertisement=";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TiVendoIo - Items</title>

<!-- Bootstrap -->
<link href="/serviceTechnologies/bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Select2 -->
<link href="/serviceTechnologies/select2-3.4.6/select2.css"
	rel="stylesheet">
<link href="/serviceTechnologies/css/select2-bootstrap.css"
	rel="stylesheet">

<link
	href="//netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css"
	rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('#footer').load('/serviceTechnologies/common/footer.jsp');
		$('#navbar').load('/serviceTechnologies/common/navbar.jsp');
	});
</script>

</head>
<body>

	<div id="navbar"></div>

	<div class="container">

		<!-- Search Box -->

		<div class="row">
			<div class="col-sm-12 col-md-12">
				<form class="navbar-form" role="search" action="./SearchProducts"
					method="GET">
					<div class="input-group">
						<input type="text" class="form-control" placeholder="Search"
							name="srch-term" id="srch-term">
						<div class="input-group-btn">
							<button class="btn btn-default" type="submit">
								<i class="glyphicon glyphicon-search"></i>
							</button>
						</div>
					</div>
				</form>
			</div>
		</div>

		<div class="row" style="overflow: hidden;">
			<!-- ISellToYou Ads -->
			<div class="col-md-4"
				style="padding-right: 20px; border-right: 1px solid #ccc; margin-bottom: -99999px; padding-bottom: 99999px;">
				<h3 align="center">Ti Vendo Io</h3>
				<%
					if (list != null) {
						for (Product p : list.getList()) {
							if (p.getType().compareTo("iselltoyou") == 0) {
				%>
				<div class="row">
					<img src="<%=imageSource + p.getId()%>" class="img-rounded"
						style="display: block; margin-left: auto; margin-right: auto; max-width: 250px; max-height: 200px;">
				</div>
				<div class="row">
					<p align="center"><%=p.getTitle()%></p>
				</div>
				<div class="row" style="text-align: center;">
					<a href="./ShowAD?idAdvertisement=<%=p.getId()%>&WikiInfo=true">
						<button class="btn btn-default btn-primary btn-sm">
							<span class="glyphicon glyphicon-eye-open"></span> Take a Look!
						</button>
					</a>
				</div>
				<br>
				<%
					}
						}
					}
				%>
			</div>

			<!-- Ebay Ads -->
			<div class="col-md-4"
				style="padding-right: 20px; border-right: 1px solid #ccc; margin-bottom: -99999px; padding-bottom: 99999px;">
				<h3 align="center">Ebay</h3>
				<br>
				<%
					if (list != null) {
						for (Product p : list.getList()) {
							if (p.getType().compareTo("ebay") == 0) {
				%>
				<div class="row">
					<img src="<%=p.getImage()%>" class="img-rounded"
						style="display: block; margin-left: auto; margin-right: auto; max-width: 250px; max-height: 200px;">
				</div>
				<div class="row">
					<p align="center"><%=p.getTitle()%></p>
				</div>
				<div class="row" style="text-align: center;">
					<a href="<%=p.getLink()%>" target="_blank">
						<button class="btn btn-default btn-primary btn-sm">
							<span class="glyphicon glyphicon-eye-open"></span> Take a Look!
						</button>
					</a>
				</div>
				<br>
				<%
					}
						}
					}
				%>

			</div>

			<!-- Amazon Ads -->
			<div class="col-md-4"
				style="margin-bottom: -99999px; padding-bottom: 99999px;">
				<h3 align="center">Amazon</h3>
				<%
					if (list != null) {
						for (Product p : list.getList()) {
							if (p.getType().compareTo("amazon") == 0) {
				%>
				<div class="row">
					<img src="<%=p.getImage()%>" class="img-rounded"
						style="display: block; margin-left: auto; margin-right: auto; max-width: 250px; max-height: 200px;">
				</div>
				<div class="row">
					<p align="center"><%=p.getTitle()%></p>
				</div>
				<div class="row" style="text-align: center;">
					<a href="<%=p.getLink()%>" target="_blank">
						<button class="btn btn-default btn-primary btn-sm">
							<span class="glyphicon glyphicon-eye-open"></span> Take a Look!
						</button>
					</a>
				</div>
				<br>
				<%
					}
						}
					}
				%>
			</div>
		</div>

	</div>
	<!-- End Container -->

	<br>

	<div id="footer"></div>
	<!-- End footer -->


</body>
</html>